<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // var reverse = function (x) {
            
        //     var num = 0;
        //     while (x != 0) {
        //         num = num * 10 + x % 10;
        //         x = parseInt(x/10);
        //         console.log(num);
        //     }

        
        //     if (num <= -2147483648 || num >=2147483647 || num == 0) {
        //         return 0;
        //     } else {
        //         return num;
        //     }
        // }
        // var res = reverse(-123);
        // console.log(res)
        // var num = -Math.pow(2,31)
        // console.log(num);
        var x = 458888866666666664335676807600;
        var num = 0;
        while(x!=0){
            num = num*10+x%10;
            x = parseInt(x/10);
        }
        if(num<=-Math.pow(2,31)||num>=Math.pow(2,31)||num==0){
            num =0 
        }
        console.log(num)
    </script>
</body>

</html>